importPackage(com.blocks.blocks);
importPackage(com.blocks);
importPackage(com.blocks.model);
importPackage(com.jme3.math);
importPackage(java.lang);
importPackage(com.blocks.script);
importPackage(com.jme3.math);
importPackage(com.jme3.collision);
importPackage(com.jme3.scene.debug);
importPackage(com.jme3.scene);
importPackage(com.jme3.material);
importPackage(com.blocks.gui);

var block = new Object(); 
var counter = 0;
var BULLET_LIFE = 20; //How long the Bullet will live

var FREQUENCY = 5;
block.setup = function(name) {
 	thisBlock.setName("TestScript");
 	thisBlock.setTextureRow(0.0);
	thisBlock.setTextureColumn(1.0);	
 	thisBlock.resetTexture();
	thisBlock.setBlockListGroup(BlockListGroup.GROUP);	
  } 
block.loop = function(name, tpf) { 
	if(thisBlock.isPowered() && thisBlock.getFrequency(thisBlock.getBlockSides()) > FREQUENCY){
		counter = counter + tpf;

		if(counter > 1){
				
var masterBlock = new MasterBlock("MasterBlock", new Long(System.currentTimeMillis()));
masterBlock.init();
masterBlock.setLocalTranslation(thisBlock.getWorldTranslation());
ScriptBlocksApplication.getInstance().getRootNode().attachChild(masterBlock);
masterBlock.setDeathTimer(BULLET_LIFE);
	var RotateBlock1866211180 = new RotateBlock("RotateBlock1866211180", masterBlock.getMasterId());
	RotateBlock1866211180.setBlockSides(BlockSides.SIDE_ABOVE);
	RotateBlock1866211180.init();
	RotateBlock1866211180.setLocalTranslation(new Vector3f(0.0, 2.0, 0.0));
	RotateBlock1866211180.setLocalRotation(new Quaternion(0.0, 0.9189593, 0.0, 0.39435238));
	RotateBlock1866211180.setAxis(1);
	masterBlock.attachChild(RotateBlock1866211180);
		var Block1198364871 = new Block("Block1198364871", masterBlock.getMasterId());
		Block1198364871.setBlockSides(BlockSides.SIDE_ABOVE);
		Block1198364871.setCustomFrequency(true);
		Block1198364871.setScriptName("/blocks/One.js");
		Block1198364871.init();
		Block1198364871.setLocalTranslation(new Vector3f(0.0, 2.0, 0.0));
	RotateBlock1866211180.attachChild(Block1198364871);
			var Block1602472377 = new Block("Block1602472377", masterBlock.getMasterId());
			Block1602472377.setBlockSides(BlockSides.SIDE_ABOVE);
			Block1602472377.setCustomFrequency(true);
			Block1602472377.setScriptName("/blocks/RepelBlock.js");
			Block1602472377.init();
			Block1602472377.setLocalTranslation(new Vector3f(0.0, 2.0, 0.0));
	Block1198364871.attachChild(Block1602472377);
				var SoundBlock946550258 = new SoundBlock("SoundBlock946550258", masterBlock.getMasterId());
				SoundBlock946550258.setBlockSides(BlockSides.SIDE_ABOVE);
				SoundBlock946550258.init();
				SoundBlock946550258.setLocalTranslation(new Vector3f(0.0, 2.0, 0.0));
	Block1602472377.attachChild(SoundBlock946550258);
				var ColorBlock2044539923 = new ColorBlock("ColorBlock2044539923", masterBlock.getMasterId());
				ColorBlock2044539923.setBlockSides(BlockSides.SIDE_LEFT);
				ColorBlock2044539923.init();
				ColorBlock2044539923.setLocalTranslation(new Vector3f(2.0, 0.0, 0.0));
	Block1602472377.attachChild(ColorBlock2044539923);
					var ColorBlock482377260 = new ColorBlock("ColorBlock482377260", masterBlock.getMasterId());
					ColorBlock482377260.setBlockSides(BlockSides.SIDE_LEFT);
					ColorBlock482377260.init();
					ColorBlock482377260.setLocalTranslation(new Vector3f(2.0, 0.0, 0.0));
	ColorBlock2044539923.attachChild(ColorBlock482377260);
						var ColorBlock349568441 = new ColorBlock("ColorBlock349568441", masterBlock.getMasterId());
						ColorBlock349568441.setBlockSides(BlockSides.SIDE_LEFT);
						ColorBlock349568441.init();
						ColorBlock349568441.setLocalTranslation(new Vector3f(2.0, 0.0, 0.0));
	ColorBlock482377260.attachChild(ColorBlock349568441);
							var ColorBlock1614740388 = new ColorBlock("ColorBlock1614740388", masterBlock.getMasterId());
							ColorBlock1614740388.setBlockSides(BlockSides.SIDE_LEFT);
							ColorBlock1614740388.init();
							ColorBlock1614740388.setLocalTranslation(new Vector3f(2.0, 0.0, 0.0));
	ColorBlock349568441.attachChild(ColorBlock1614740388);
ScriptBlocksApplication.getInstance().addMasterBlock(masterBlock.getMasterId(),masterBlock);
masterBlock.updatePower(true);

				counter = 0;
				
		}
	}
	
 }


block.scriptExport = function() {
	return ("");
} 

